home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / arrayinsertat.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  798 b   |  28 lines

  1. <!--- This example shows ArrayInsertAt --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>ArrayInsertAt Example</TITLE>
  5. </HEAD>
  6.  
  7. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  8. <BODY  bgcolor="#FFFFD5">
  9.  
  10. <H3>ArrayInsertAt Example</H3>
  11.  
  12. <P>
  13. <!--- create a new array --->
  14. <CFSET DaysArray = ArrayNew(1)>
  15. <!--- populate an element or two --->
  16. <CFSET DaysArray[1] = "Monday">
  17. <CFSET DaysArray[2] = "Tuesday">
  18. <CFSET DaysArray[3] = "Thursday">
  19. <!--- add an element before position 3 --->
  20. <P>Add an element before position 3: <CFOUTPUT>#ArrayInsertAt(DaysArray,3,"Wednesday")#</CFOUTPUT>
  21. <P>Now output the array as a list:
  22. <CFOUTPUT>#ArrayToList(DaysArray)#</CFOUTPUT>
  23. <!--- Notice how the array now has four elements, and that
  24. element 3, "Thursday", has now become element four --->
  25.  
  26. </BODY>
  27. </HTML>       
  28.